library(googlesheets4)
library(sf)
library(sfheaders)
library(tidyverse)
library(southernMaps)
library(mapview)
library(terra)
library(tidyterra)
library(rcartocolor)
library(ggnewscale)
library(ggspatial)
library(kableExtra)
library(ggrepel)
theme_set(theme_bw())Plan for Fiordland BRUV FLD25
Setup
Load NZ coastline data
… and convert to sf object.
nztm <- detailed_nz_islands |> st_as_sf()Marine reserves data
load(file = "data/mr_fiordland.Rdata")Load strata
strata <- st_read("data/FLD25_Strata.kml")Reading layer `Strata' from data source
`C:\git_projects\fiordland_bruv\data\FLD25_Strata.kml' using driver `KML'
Simple feature collection with 13 features and 2 fields
Geometry type: POLYGON
Dimension: XYZ
Bounding box: xmin: 166.3883 ymin: -45.8432 xmax: 167.0177 ymax: -45.47082
z_range: zmin: 0 zmax: 0
Geodetic CRS: WGS 84
plot(strata)Load mark
mark <- png::readPNG("img/mark_blank.png") |> grid::rasterGrob(interpolate=TRUE)BRUV data
Load from Google Sheet
… and convert to sf object.
fld24 <- read_sheet(
"https://docs.google.com/spreadsheets/d/1IQfLTiWTQnTGynuF7fUu8htJxKZuIVJw4OK6y9qRfU8",
sheet="FLD24") |>
mutate(Depth = coalesce(`Depth sensor`,`Depth sounder`)) |>
st_as_sf(coords = c('Longitude','Latitude'), crs=4326) |>
st_join(strata["Name"]) |>
filter(Quality %in% c("Good", "OK"))Write full dataset to csv file (for copying stratum column into BRUVmetadata – actually nah)
read_sheet(
"https://docs.google.com/spreadsheets/d/1IQfLTiWTQnTGynuF7fUu8htJxKZuIVJw4OK6y9qRfU8",
sheet="FLD24") |>
mutate(Depth = coalesce(`Depth sensor`,`Depth sounder`)) |>
st_as_sf(coords = c('Longitude','Latitude'), crs=4326) |>
st_join(strata["Name"]) |>
write_csv(file = "data/fld24_strata.csv")✔ Reading from "BRUVmetadata".
✔ Range ''FLD24''.
st_as_s2(): dropping Z and/or M coordinate
Export data for printing
dstrat <- c("DZ1","DZ2","DR2","DZ3","DZ4" )fld24_toprint <- fld24 |>
filter(Quality != "BAD") |>
as_data_frame() |>
transmute(
SiteID,
SetRep = substring(OpCode, 7, 13),
Loc = Location,
Stratum = Name |>
fct_relevel(dstrat),
Depth,
lat = st_coordinates(fld24)[,2] |> round(5),
lon = st_coordinates(fld24)[,1] |> round(5)
) |>
arrange(Stratum)Warning: `as_data_frame()` was deprecated in tibble 2.0.0.
ℹ Please use `as_tibble()` (with slightly different semantics) to convert to a
tibble, or `as.data.frame()` to convert to a data frame.
kable(fld24_toprint)| SiteID | SetRep | Loc | Stratum | Depth | lat | lon |
|---|---|---|---|---|---|---|
| LC01 | S02_R01 | Luncheon Cove | DZ1 | 35.9 | -45.77672 | 166.4945 |
| LC02 | S02_R02 | Luncheon Cove | DZ1 | 23.0 | -45.77042 | 166.4982 |
| LC03 | S02_R03 | Luncheon Cove | DZ1 | 34.0 | -45.77522 | 166.5058 |
| LC08 | S02_R05 | Luncheon Cove | DZ1 | 40.0 | -45.76553 | 166.5292 |
| LC06 | S02_R06 | Luncheon Cove | DZ1 | 42.0 | -45.77145 | 166.5326 |
| AI08 | S03_R02 | Anchor Island | DZ1 | 21.0 | -45.73870 | 166.5252 |
| AI09 | S03_R03 | Anchor Island | DZ1 | 38.0 | -45.74827 | 166.5181 |
| AI10 | S03_R04 | Anchor Island | DZ1 | 28.0 | -45.74457 | 166.5100 |
| AI11 | S03_R05 | Anchor Island | DZ1 | 71.0 | -45.74618 | 166.5016 |
| AI12 | S03_R06 | Anchor Island | DZ1 | 71.0 | -45.75023 | 166.5000 |
| AI01 | S04_R01 | Anchor Island | DZ1 | 41.8 | -45.75005 | 166.5258 |
| AI02 | S04_R02 | Anchor Island | DZ1 | 79.0 | -45.74478 | 166.5167 |
| AI03 | S04_R03 | Anchor Island | DZ1 | 20.0 | -45.74017 | 166.5253 |
| LC04 | S05_R04 | Luncheon Cove | DZ1 | 86.0 | -45.77767 | 166.5152 |
| LC05 | S05_R05 | Luncheon Cove | DZ1 | 45.0 | -45.77575 | 166.5234 |
| LC07 | S05_R06 | Luncheon Cove | DZ1 | 30.0 | -45.76930 | 166.5201 |
| OF01 | S22_R01 | Outer Five Fingers | DZ1 | 34.0 | -45.71893 | 166.4898 |
| OF02 | S22_R02 | Outer Five Fingers | DZ1 | 44.0 | -45.72385 | 166.4839 |
| OF03 | S22_R03 | Outer Five Fingers | DZ1 | 25.0 | -45.72788 | 166.4762 |
| OF04 | S22_R04 | Outer Five Fingers | DZ1 | 34.0 | -45.73192 | 166.4712 |
| OF05 | S22_R05 | Outer Five Fingers | DZ1 | 17.0 | -45.73392 | 166.4650 |
| OF06 | S22_R06 | Outer Five Fingers | DZ1 | 31.0 | -45.73877 | 166.4598 |
| EA02 | S01_R02 | East Anchor | DZ2 | 23.0 | -45.76108 | 166.5369 |
| EA03 | S01_R03 | East Anchor | DZ2 | 79.0 | -45.75900 | 166.5446 |
| EA08 | S01_R04 | East Anchor | DZ2 | 17.0 | -45.77003 | 166.5534 |
| EA05 | S01_R05 | East Anchor | DZ2 | 65.0 | -45.76277 | 166.5631 |
| EA06 | S01_R06 | East Anchor | DZ2 | 86.0 | -45.76553 | 166.5525 |
| AI07 | S03_R01 | Anchor Island | DZ2 | 49.1 | -45.73245 | 166.5272 |
| AI04 | S04_R04 | Anchor Island | DZ2 | 83.0 | -45.73032 | 166.5401 |
| AI05 | S04_R05 | Anchor Island | DZ2 | 54.0 | -45.74125 | 166.5464 |
| AI06 | S04_R06 | Anchor Island | DZ2 | 29.0 | -45.74172 | 166.5556 |
| EA01 | S05_R01 | East Anchor | DZ2 | 57.0 | -45.76440 | 166.5409 |
| EA04 | S05_R02 | East Anchor | DZ2 | 30.0 | -45.75715 | 166.5584 |
| EA07 | S05_R03 | East Anchor | DZ2 | 38.0 | -45.77055 | 166.5717 |
| RI01 | S08_R01 | Resolution Island | DZ2 | 19.2 | -45.72102 | 166.5831 |
| RI02 | S08_R02 | Resolution Island | DZ2 | 34.0 | -45.71980 | 166.5733 |
| PP02 | S08_R05 | Pigeon & Parrot Islands | DZ2 | 40.0 | -45.71513 | 166.5280 |
| PP03 | S08_R06 | Pigeon & Parrot Islands | DZ2 | 32.0 | -45.72005 | 166.5267 |
| LI02 | S17_R02 | Long Island | DZ2 | 30.0 | -45.77093 | 166.6043 |
| LI03 | S17_R03 | Long Island | DZ2 | 23.0 | -45.77240 | 166.6003 |
| LI04 | S17_R04 | Long Island | DZ2 | 25.0 | -45.77600 | 166.6013 |
| PH01 | S19_R01 | Pickersgill Harbour | DZ2 | 31.5 | -45.79447 | 166.5908 |
| PH02 | S19_R02 | Pickersgill Harbour | DZ2 | 33.0 | -45.79415 | 166.5842 |
| PH03 | S19_R03 | Pickersgill Harbour | DZ2 | 42.0 | -45.79445 | 166.5934 |
| PH04 | S19_R04 | Pickersgill Harbour | DZ2 | 32.0 | -45.78363 | 166.5830 |
| PH05 | S19_R05 | Pickersgill Harbour | DZ2 | 81.0 | -45.78190 | 166.6001 |
| ES01 | S21_R01 | Earshell Cove | DZ2 | 31.2 | -45.72475 | 166.5894 |
| ES02 | S21_R02 | Earshell Cove | DZ2 | 48.0 | -45.72678 | 166.5842 |
| ES03 | S21_R03 | Earshell Cove | DZ2 | 21.0 | -45.73117 | 166.5777 |
| ES04 | S21_R04 | Earshell Cove | DZ2 | 46.0 | -45.73853 | 166.5701 |
| ES05 | S21_R05 | Earshell Cove | DZ2 | 60.0 | -45.74320 | 166.5735 |
| ES06 | S21_R06 | Earshell Cove | DZ2 | 52.7 | -45.74770 | 166.5760 |
| FH01 | S23_R01 | Fixed Head | DZ2 | 25.0 | -45.76270 | 166.5871 |
| FH02 | S23_R02 | Fixed Head | DZ2 | 45.0 | -45.75477 | 166.6083 |
| FH03 | S23_R03 | Fixed Head | DZ2 | 18.0 | -45.74933 | 166.6143 |
| FF01 | S06_R01 | Five Fingers | DR2 | 31.1 | -45.70582 | 166.5711 |
| FF02 | S06_R02 | Five Fingers | DR2 | 52.0 | -45.70425 | 166.5616 |
| FF03 | S06_R03 | Five Fingers | DR2 | 63.0 | -45.70360 | 166.5512 |
| FF04 | S06_R04 | Five Fingers | DR2 | 86.0 | -45.70063 | 166.5412 |
| FF05 | S06_R05 | Five Fingers | DR2 | 25.0 | -45.69333 | 166.5438 |
| FF06 | S06_R06 | Five Fingers | DR2 | 18.0 | -45.69175 | 166.5565 |
| FF07 | S07_R01 | Five Fingers | DR2 | 28.5 | -45.68888 | 166.5305 |
| FF08 | S07_R02 | Five Fingers | DR2 | 28.0 | -45.69353 | 166.5240 |
| FF09 | S07_R03 | Five Fingers | DR2 | 27.0 | -45.69867 | 166.5181 |
| FF10 | S07_R04 | Five Fingers | DR2 | 26.0 | -45.70330 | 166.5104 |
| FF11 | S07_R05 | Five Fingers | DR2 | 18.0 | -45.70938 | 166.5012 |
| FF12 | S07_R06 | Five Fingers | DR2 | 41.0 | -45.71433 | 166.4979 |
| RI03 | S08_R03 | Resolution Island | DR2 | 25.0 | -45.71353 | 166.5591 |
| PP01 | S08_R04 | Pigeon & Parrot Islands | DR2 | 39.0 | -45.70965 | 166.5481 |
| SI05 | S09_R05 | Shag Island | DZ3 | 35.0 | -45.74290 | 166.7680 |
| SI06 | S09_R06 | Shag Island | DZ3 | 28.0 | -45.74382 | 166.7570 |
| SI11 | S15_R05 | Shag Island | DZ3 | 64.0 | -45.74245 | 166.7635 |
| SI12 | S15_R06 | Shag Island | DZ3 | 45.0 | -45.74392 | 166.7555 |
| II01 | S16_R01 | Indian Island | DZ3 | 28.0 | -45.76110 | 166.6465 |
| II02 | S16_R02 | Indian Island | DZ3 | 57.0 | -45.76187 | 166.6405 |
| II03 | S16_R03 | Indian Island | DZ3 | 36.0 | -45.76823 | 166.6378 |
| II04 | S16_R04 | Indian Island | DZ3 | 46.0 | -45.76727 | 166.6315 |
| II05 | S16_R05 | Indian Island | DZ3 | 28.0 | -45.77097 | 166.6236 |
| II06 | S16_R06 | Indian Island | DZ3 | 47.0 | -45.76517 | 166.6241 |
| LI01 | S17_R01 | Long Island | DZ3 | 14.2 | -45.76587 | 166.6148 |
| LI05 | S17_R05 | Long Island | DZ3 | 38.0 | -45.77637 | 166.6087 |
| LI06 | S17_R06 | Long Island | DZ3 | 69.0 | -45.77782 | 166.6129 |
| CL01 | S18_R01 | Curlew Island | DZ3 | 38.7 | -45.78558 | 166.6075 |
| CL02 | S18_R02 | Curlew Island | DZ3 | 42.0 | -45.78937 | 166.6088 |
| CL03 | S18_R03 | Curlew Island | DZ3 | 38.0 | -45.79812 | 166.6120 |
| CL04 | S18_R04 | Curlew Island | DZ3 | 21.0 | -45.80265 | 166.5988 |
| CL05 | S18_R05 | Curlew Island | DZ3 | 33.0 | -45.80528 | 166.5881 |
| CL06 | S18_R06 | Curlew Island | DZ3 | 68.0 | -45.79398 | 166.5990 |
| PH06 | S19_R06 | Pickersgill Harbour | DZ3 | 79.0 | -45.79087 | 166.6021 |
| DC01 | S20_R01 | Duck Cove | DZ3 | 25.0 | -45.74697 | 166.6567 |
| DC02 | S23_R04 | Duck Cove | DZ3 | 46.0 | -45.74255 | 166.6531 |
| DC03 | S23_R05 | Duck Cove | DZ3 | 17.0 | -45.74692 | 166.6521 |
| DC04 | S23_R06 | Duck Cove | DZ3 | 45.0 | -45.74880 | 166.6580 |
| BW01 | S24_R01 | Bowen Channel | DZ3 | 32.8 | -45.73972 | 166.6971 |
| BW02 | S24_R02 | Bowen Channel | DZ3 | 53.0 | -45.73017 | 166.7091 |
| BW03 | S24_R03 | Bowen Channel | DZ3 | 36.0 | -45.72955 | 166.7153 |
| BW04 | S24_R04 | Bowen Channel | DZ3 | 20.0 | -45.72763 | 166.7263 |
| BW05 | S24_R05 | Bowen Channel | DZ3 | 51.0 | -45.73610 | 166.7239 |
| BW06 | S24_R06 | Bowen Channel | DZ3 | 22.0 | -45.74022 | 166.7223 |
| SI01 | S09_R01 | Shag Island | DZ4 | 49.6 | -45.74372 | 166.7880 |
| SI02 | S09_R02 | Shag Island | DZ4 | 29.0 | -45.73778 | 166.7870 |
| SI03 | S09_R03 | Shag Island | DZ4 | 24.0 | -45.73197 | 166.7870 |
| SI04 | S09_R04 | Shag Island | DZ4 | 36.0 | -45.73337 | 166.7697 |
| EC01 | S10_R01 | East Cooper Island | DZ4 | 36.4 | -45.73463 | 166.9211 |
| EC03 | S10_R03 | East Cooper Island | DZ4 | 30.0 | -45.73527 | 166.8988 |
| EC04 | S10_R04 | East Cooper Island | DZ4 | 28.0 | -45.73700 | 166.8860 |
| EC05 | S10_R05 | East Cooper Island | DZ4 | 70.0 | -45.72872 | 166.8818 |
| EC06 | S10_R06 | East Cooper Island | DZ4 | 58.0 | -45.72575 | 166.8994 |
| SC01 | S11_R01 | Supper Cove | DZ4 | 25.4 | -45.70307 | 166.9534 |
| SC02 | S11_R02 | Supper Cove | DZ4 | 55.0 | -45.70700 | 166.9553 |
| SC03 | S11_R03 | Supper Cove | DZ4 | 64.0 | -45.71162 | 166.9528 |
| SC04 | S11_R04 | Supper Cove | DZ4 | 65.0 | -45.70937 | 166.9479 |
| SC05 | S11_R05 | Supper Cove | DZ4 | 54.0 | -45.70732 | 166.9435 |
| SC06 | S11_R06 | Supper Cove | DZ4 | 23.0 | -45.70253 | 166.9462 |
| SH01 | S12_R01 | Shark Cove | DZ4 | 71.4 | -45.72023 | 166.9660 |
| SH02 | S12_R02 | Shark Cove | DZ4 | 51.0 | -45.71955 | 166.9714 |
| SH03 | S12_R03 | Shark Cove | DZ4 | 28.0 | -45.71705 | 166.9761 |
| SH04 | S12_R04 | Shark Cove | DZ4 | 33.0 | -45.72855 | 166.9508 |
| SH05 | S12_R05 | Shark Cove | DZ4 | 51.0 | -45.73150 | 166.9468 |
| SH06 | S12_R06 | Shark Cove | DZ4 | 32.0 | -45.72108 | 166.9484 |
| FB01 | S13_R01 | Cooper Island | DZ4 | 27.0 | -45.73793 | 166.8813 |
| FB02 | S13_R02 | Cooper Island | DZ4 | 45.0 | -45.74085 | 166.8779 |
| FB03 | S13_R03 | Cooper Island | DZ4 | 52.0 | -45.74118 | 166.8691 |
| FB04 | S13_R04 | Cooper Island | DZ4 | 27.0 | -45.75247 | 166.8626 |
| FB05 | S13_R05 | Fanny Bay | DZ4 | 62.0 | -45.76213 | 166.8347 |
| FB06 | S13_R06 | Fanny Bay | DZ4 | 71.0 | -45.77178 | 166.8419 |
| NC01 | S14_R01 | North Cooper Island | DZ4 | 55.0 | -45.71055 | 166.8425 |
| NC02 | S14_R02 | North Cooper Island | DZ4 | 32.0 | -45.70575 | 166.8288 |
| NC03 | S14_R03 | North Cooper Island | DZ4 | 85.0 | -45.71613 | 166.7994 |
| NC04 | S14_R04 | North Cooper Island | DZ4 | 18.0 | -45.71837 | 166.7825 |
| NC05 | S14_R05 | North Cooper Island | DZ4 | 28.0 | -45.72338 | 166.7607 |
| NC06 | S14_R06 | North Cooper Island | DZ4 | 18.0 | -45.72658 | 166.7987 |
| SI07 | S15_R01 | Shag Island | DZ4 | 42.1 | -45.72988 | 166.7899 |
| SI08 | S15_R02 | Shag Island | DZ4 | 36.0 | -45.73352 | 166.7811 |
| SI09 | S15_R03 | Shag Island | DZ4 | 46.0 | -45.73128 | 166.7773 |
| SI10 | S15_R04 | Shag Island | DZ4 | 15.0 | -45.73295 | 166.7671 |
# fld24_toprint |> write_csv(file = "data/fld24_toprint.csv")First mapviews
mapview(fld24)map_fiordland24 <- fld24 |>
mutate(Depth = -Depth) |>
mapview(zcol="Depth", layer.name = "BRUV drops (Depth)") +
mapview(mr_fiordland |>
filter(Name %in% c(
"Moana Uta (Wet Jacket Arm) Marine Reserve",
"Taumoana (Five Finger Peninsula) Marine Reserve"
)),
layer.name = "Marine Reserves",
col.region = "yellow")
map_fiordland24saveRDS( map_fiordland24, "maps/map_fiordland24.rds")
mapshot(map_fiordland24, url = "maps/map_fiordland24.html")nrow(fld24)[1] 136
fld24 |>
group_by(Quality) |>
summarise(n = n())Simple feature collection with 2 features and 2 fields
Geometry type: MULTIPOINT
Dimension: XY
Bounding box: xmin: 166.4598 ymin: -45.80528 xmax: 166.9761 ymax: -45.68888
Geodetic CRS: WGS 84
# A tibble: 2 × 3
Quality n geometry
<chr> <int> <MULTIPOINT [°]>
1 Good 120 ((166.5305 -45.68888), (166.524 -45.69353), (166.5012 -45.70938…
2 OK 16 ((166.465 -45.73392), (166.4979 -45.71433), (166.6521 -45.74692…
fld24 |>
group_by(`Repeat site from 2021`) |>
summarise(n = n())Simple feature collection with 2 features and 2 fields
Geometry type: MULTIPOINT
Dimension: XY
Bounding box: xmin: 166.4598 ymin: -45.80528 xmax: 166.9761 ymax: -45.68888
Geodetic CRS: WGS 84
# A tibble: 2 × 3
`Repeat site from 2021` n geometry
<chr> <int> <MULTIPOINT [°]>
1 No 112 ((166.5305 -45.68888), (166.524 -45.69353), (16…
2 Yes 24 ((166.5152 -45.77767), (166.5058 -45.77522), (1…
fld24 |>
filter(Quality != "BAD") |>
summarise(
min = min(Depth),
max = max(Depth),
mean = mean(Depth),
median = median(Depth)
)Simple feature collection with 1 feature and 4 fields
Geometry type: MULTIPOINT
Dimension: XY
Bounding box: xmin: 166.4598 ymin: -45.80528 xmax: 166.9761 ymax: -45.68888
Geodetic CRS: WGS 84
# A tibble: 1 × 5
min max mean median geometry
<dbl> <dbl> <dbl> <dbl> <MULTIPOINT [°]>
1 14.2 86 40.8 36 ((166.5305 -45.68888), (166.524 -45.69353), (166.501…
Calculate areas
strata_clipped <- strata |>
st_transform(2193) |>
st_difference( nztm |> st_union() ) Warning: attribute variables are assumed to be spatially constant throughout
all geometries
plot(strata_clipped)strata_areas <- strata_clipped |>
mutate( Area = ( strata |> st_area() / 1e6 ) |> units::drop_units()) |>
select(Name, Area) |>
st_drop_geometry()st_as_s2(): dropping Z and/or M coordinate
strata_samples <- fld24 |>
filter(Quality != "Bad") |>
group_by(Name) |>
summarise(n = n()) |>
st_drop_geometry() |>
left_join(strata_areas) |>
mutate(
Area = round(Area, 1),
Sites_per_area = round(n / Area, 3)
) Joining with `by = join_by(Name)`
strata_samples# A tibble: 5 × 4
Name n Area Sites_per_area
<chr> <int> <dbl> <dbl>
1 DR2 14 23.2 0.603
2 DZ1 22 57.5 0.383
3 DZ2 33 54.8 0.602
4 DZ3 30 74.1 0.405
5 DZ4 37 76.1 0.486
kable(strata_samples)| Name | n | Area | Sites_per_area |
|---|---|---|---|
| DR2 | 14 | 23.2 | 0.603 |
| DZ1 | 22 | 57.5 | 0.383 |
| DZ2 | 33 | 54.8 | 0.602 |
| DZ3 | 30 | 74.1 | 0.405 |
| DZ4 | 37 | 76.1 | 0.486 |
fld24 |> filter(Quality != "Bad") |> ggplot() + aes(x=Depth) + geom_histogram() `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
fld24 |>
filter(Quality != "Bad") |>
ggplot() + aes(x=Depth) + geom_histogram() + facet_wrap(vars(Name))`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Depths
fld24 |>
ggplot() +
aes(x = `Depth sounder`, y = `Depth sensor`) +
geom_point() +
geom_abline(slope=1, intercept = 0)Warning: Removed 24 rows containing missing values or values outside the scale range
(`geom_point()`).
Mappy map map
bathy_tamatea <- readRDS("data/bathy_tamatea.rds")lim_tamatea_nzmg <- ext( c(2000000, 2042000, 5464000, 5488000) )Points and strata 2024
ggmap_fld24_strata <- ggplot() +
geom_spatraster(data = bathy_tamatea) +
scale_fill_hypso_c(name = "Depth (m)", palette="colombia_bathy") +
new_scale_fill() +
geom_sf(
data = strata |>
filter(Name %in% dstrat),
aes(fill = Name),
colour = 'black',
alpha = .5
) +
geom_sf(data = nztm, fill='grey40', colour=NA) +
geom_sf(data = fld24, size = 2, color = "black") +
geom_sf_text(
data = strata |>
filter(Name %in% dstrat),
aes(label = Name),
colour = "white",
nudge_y = c(-1500,0,0,0,0)) + # Label strata
scale_fill_brewer(name = "Stratum", palette = "Set2") +
# scale_fill_viridis_d(name = "Stratum", option = "C", alpha = 0.7) +
scale_x_continuous(limits = lim_tamatea_nzmg[1:2],
expand = c(0, 0)) +
scale_y_continuous(limits = lim_tamatea_nzmg[3:4],
expand = c(0, 0)) +
annotation_scale(location = "br") +
annotate("text", label = "Sea Through Science Ltd.") +
xlab("") + ylab("")<SpatRaster> resampled to 500760 cells.
ggmap_fld24_strataggmap_fld24_strata +
annotation_custom(mark, xmin = 2031500, xmax = 2042000, ymin = 5464000, ymax = 5470000)ggsave("maps/map_fld24_strata.png", width = 10, height = 6, dpi = 300)Strata with Breaksea too
get bbox
strata_nzmg <- strata |>
st_transform(strata, crs = 27200)
bbox_strata <- strata_nzmg |>
st_bbox()
bbox_strata xmin ymin xmax ymax
1995923 5464579 2042666 5507907
ggmap_allstrata <- ggplot() +
# geom_spatraster(data = bathy_tamatea, alpha = 0.1) +
#
# scale_fill_hypso_c(name = "Depth (m)", palette="colombia_bathy") +
# new_scale_fill() +
geom_sf(
data = strata_nzmg |>
st_transform(strata, crs = 27200),
aes(fill = Name),
colour = 'black',
alpha = .5
) +
geom_sf(data = nztm, fill='grey40', colour=NA) +
geom_sf(data = fld24, size = 2, color = "black", alpha = .5) +
geom_sf_text(
data = strata,
aes(label = Name),
colour = "black",
fontface = "bold",
nudge_y = c(0,0,0,500,-1500,0,0,0,0,0,0,0,0)
) + # Label strata
# scale_fill_brewer(name = "Stratum", palette = "Set2") +
scale_x_continuous(limits = c(bbox_strata["xmin"], bbox_strata["xmax"]),
expand = c(0, 0)) +
scale_y_continuous(limits = c(bbox_strata["ymin"], bbox_strata["ymax"]),
expand = c(0, 0)) +
annotation_scale(location = "br") +
annotate("text", label = "Sea Through Science Ltd.") +
xlab("") + ylab("") +
theme(legend.position = "none")
ggmap_allstrataggmap_allstrata +
annotation_custom(mark, xmin = 2031500, xmax = 2042000, ymin = 5464000, ymax = 5470000)ggsave("maps/map_allstrata.png", width = 8, height = 8, dpi = 300)
ggsave("maps/map_allstrata.pdf", width = 8, height = 8)Labelled map of 2024 sites
ggmap_fld24_labels <-
ggmap_fld24_strata +
geom_label_repel(
data = fld24, # |>
# mutate(
# X = st_coordinates(fld24)[,1],
# Y = st_coordinates(fld24)[,2]
# ),
aes(label = SiteID, geometry = geometry),
stat = "sf_coordinates",
# size = 1,
max.overlaps = 12,
alpha = 0.6,
box.padding = 0.05,
point.padding = 0.05,
min.segment.length = 0)
ggmap_fld24_labelsggmap_fld24_labels +
annotation_custom(mark, xmin = 2031500, xmax = 2042000, ymin = 5464000, ymax = 5470000)ggsave("maps/map_fld24_labels.png", width = 18, height = 13, dpi = 300)
ggsave("maps/map_fld24_labels.pdf", width = 18, height = 13)Points and reserves
ggmap_fld24 <- ggplot() +
geom_spatraster(data = bathy_tamatea) +
geom_sf(
data = mr_fiordland,
fill = "yellow", col = NA, alpha = .3
) +
geom_sf(data = nztm, fill='grey40', colour=NA) +
geom_sf(
data = fld24,
size = 2
) +
scale_fill_hypso_c(name = "Depth (m)", palette="colombia_bathy") +
new_scale_fill() +
scale_x_continuous(limits = lim_tamatea_nzmg[1:2],
expand = c(0, 0)) +
scale_y_continuous(limits = lim_tamatea_nzmg[3:4],
expand = c(0, 0)) +
annotation_scale(location = "br") +
annotate("text", label = "Sea Through Science Ltd.")<SpatRaster> resampled to 500760 cells.
ggmap_fld24ggmap_fld24 +
annotation_custom(mark, xmin = 2031500, xmax = 2042000, ymin = 5464000, ymax = 5470000)ggsave("maps/map_fld24.png", width = 10, height = 6, dpi = 300)